package com.zbkj.front.controller.user;

import com.zbkj.common.page.CommonPage;
import com.zbkj.common.request.*;
import com.zbkj.common.response.*;
import com.zbkj.common.result.CommonResult;
import com.zbkj.service.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 全民分红 前端控制器
 */
@Slf4j
@RestController
@RequestMapping("api/front/user/dividend")
@Api(tags = "全民分红") //配合swagger使用

public class UserDividendController {

    @Autowired
    private UserDividendRecordService userDividendRecordService;
    @Autowired
    private MarketingActivityService marketingActivityService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private PaidMemberOrderService paidMemberOrderService;
    @Autowired
    private UserBalanceRecordService userBalanceRecordService;

    /**
     * 分页显示用户艺呗记录
     *
     * @param request          搜索条件
     * @param pageParamRequest 分页参数
     * @author Caiyc
     * @since 2025-09-17
     */
    //@PreAuthorize("hasAuthority('platform:activitystyle:list')")
    @ApiOperation(value = "分页列表") //配合swagger使用
    @RequestMapping(value = "/record/my/page/list", method = RequestMethod.GET)
    public CommonResult<CommonPage<UserDividendRecordFrontPageDataResponse>> getList(@Validated UserDividendRecordFrontSearchRequest request,
                                                                                @ModelAttribute PageParamRequest pageParamRequest) {
        CommonPage<UserDividendRecordFrontPageDataResponse> userDividendRecordCommonPage =
                CommonPage.restPage(userDividendRecordService.getMyListH5(request, pageParamRequest));
        return CommonResult.success(userDividendRecordCommonPage);
    }

    @ApiOperation(value = "我的艺呗") //配合swagger使用
    @RequestMapping(value = "/my/info", method = RequestMethod.GET)
    public CommonResult<MyDividendResponse> getMyDividend() {
        return CommonResult.success(userDividendRecordService.getMyDividend());
    }

}